package com.itheima.features.optional.demo01;

import java.util.Optional;

public class OptionalDemo01 {

    public static void main(String[] args) {

        Student student = new Student("蓝湛", 15);
        if (student != null){
            student.setName("蓝忘机");
            student.setAge(16);
            System.out.println(student.getName() + student.getAge());
        }

        System.out.println("--------------");

        Optional.ofNullable(student).ifPresent(s -> System.out.println(s));
    }
}
